#! /usr/bin/env python
# encoding: utf-8

"""
A simple scanner method
"""

import time
from waflib.Task import Task
class copy(Task):

	def scan(self):
		 print('→ calling the scanner method')
		 node = self.inputs[0].parent.find_resource('wscript')
		 return ([node], time.time())

	def run(self):
		 return self.exec_command('cp %s %s' % (self.inputs[0].abspath(), self.outputs[0].abspath())
		 )

	def runnable_status(self):
		 ret = super(copy, self).runnable_status()
		 bld = self.generator.bld
		 print('nodes:	%r' % bld.node_deps[self.uid()])
		 print('custom data: %r' % bld.raw_deps[self.uid()])
		 return ret

def configure(ctx):
	pass

def build(ctx):
	tsk = copy(env=ctx.env)
	tsk.set_inputs(ctx.path.find_resource('a.in'))
	tsk.set_outputs(ctx.path.find_or_declare('b.out'))
	ctx.add_to_group(tsk)


